<!DOCTYPE html>
<html lang="en">

<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>Document</title>


   <!-- 引入css -->
   <link rel="stylesheet" href="css/bootstrap/bootstrap.min.css">
   <link rel="stylesheet" href="css/index.css">

</head>

<body>
   <div class="wrap">
      <!-- 页面外围框架 -->



      <div class="left main-box">
         <!-- 左边的盒子 -->

         <div class="btn-box">
            <button type="button" class="btn btn-primary">查询</button>
         </div>

         <div class="btn-box">
            <button type="button" class="btn btn-primary">存款</button>
         </div>

         <div class="btn-box">
            <button type="button" class="btn btn-primary">取款</button>
         </div>
         <div class="btn-box">
            <button type="button" class="btn btn-primary">挂失</button>
         </div>

      </div>


      <!-- 主体内容  银行信息 -->
      <div class="main main-box">
         <div class="main-text">
            <h2 style="text-align: center;">蛇院银行欢迎你</h2>
            <h2 style="text-align: center">请选择你的服务</h2>

         </div>
      </div>



      <!-- 右边的盒子 -->
      <div class="right main-box">
         <div class="btn-box">
            <button type="button" class="btn btn-primary">转账</button>
         </div>

         <div class="btn-box">
            <button type="button" class="btn btn-primary">改密</button>
         </div>

         <div class="btn-box">
            <button type="button" class="btn btn-primary">开户</button>
         </div>
         <div class="btn-box">
            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
               销户
            </button>
         </div>

      </div>

      <!--  -->
      <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
         <div class="modal-dialog">
            <div class="modal-content">
               <div class="modal-header">
                  <h5 class="modal-title" id="exampleModalLabel">你确认要销户吗?</h5>
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                     <span aria-hidden="true">&times;</span>
                  </button>
               </div>
               <!-- <div class="modal-body">
               ...
             </div> -->
               <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                  <button type="button" class="btn btn-primary" onclick="deleteCar()" data-dismiss="modal">确定</button>
               </div>
            </div>
         </div>
      </div>


      <script src="js/jquery-3.6.0.min.js"></script>
      <script src="css/bootstrap/bootstrap.min.js"></script>
      <script src="js/index.js"></script>
      <script>

          function deleteCar() {

            // ajax请求
            $.ajax({
               url: "/deleteCarDone",
               type: "POST",
               data: $('#exampleModal').serialize(),
               dataType: "json",
               success: function (res) {
                  console.log(res);
                  if (res.code === 200) {
                     window.location.href = "/login";
                  } else {
                     alert_fn(res.msg);
                  }

               },
               error: function (msg) {
                  alert_fn('网络或者服务器有问题');
               }
            })

           
            alert("销户成功");

         }
      </script>
</body>

</html>